UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YAcReruv1sPGCtmRRBDYFSajzOcYgozrO/VIwPPaDps=' 
WHERE 
  key_id = 'b469d5bd770638df2e873e7eb97a0d354f0ff6903af62a5095adbab7a1e2e0eb' 
  AND (
    token = 'YAcReruv1sPGCtmRRBDYFSajzOcYgozrO/VIwPPaDps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041