UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0sc0gTwOsEIdmMpSbuJ+9u8xlA3hgcMr3rXTaIqz5C4=' 
WHERE 
  key_id = '1773d42590ec76d08ab71dae20717788efa009c535025e2ce460b8d81ec8cace' 
  AND (
    token = '0sc0gTwOsEIdmMpSbuJ+9u8xlA3hgcMr3rXTaIqz5C4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023