UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gguTbOBfSop1slMTD++N46tpVOvU80mDXEA1VyBNThk=' 
WHERE 
  key_id = 'ba0d21b96d9eff13deee9adb34a08e51fa559eb5f6050bf157c6631e817b036d' 
  AND (
    token = 'gguTbOBfSop1slMTD++N46tpVOvU80mDXEA1VyBNThk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034