UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '78U/Q8HRrITvgHSPrP5qYoFhVXLQi22fHEmsNi3qauc=' 
WHERE 
  key_id = '2304012ba48beb95862bd75a15f84707f3b7a476dbf7bdda9652ff91acbed8aa' 
  AND (
    token = '78U/Q8HRrITvgHSPrP5qYoFhVXLQi22fHEmsNi3qauc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029