UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RIdoT6GXMx2Mc4+xwd/vZCk4cHqUpynrrc6Jr4hRYns=' 
WHERE 
  key_id = '55738f4021aa8460e190da3a71227ca50579ea240b15a9230741226cfcc6bf97' 
  AND (
    token = 'RIdoT6GXMx2Mc4+xwd/vZCk4cHqUpynrrc6Jr4hRYns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027