UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I0h2/ti8qi8obIQ+61pdByWAd72YYg7J6surcLm1ucs=' 
WHERE 
  key_id = '2f4fd916f6943f18794a174cc52449360f58674b15fc711e329eba78c9ab0d89' 
  AND (
    token = 'I0h2/ti8qi8obIQ+61pdByWAd72YYg7J6surcLm1ucs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034