UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FZnP03bqgojLccgCc72OCEXUUb/qMy8l2vwirACYh+k=' 
WHERE 
  key_id = 'b2af95359384c01d01f69b8ab2311de854fb1dd3bdcedb756ae84a204036da79' 
  AND (
    token = 'FZnP03bqgojLccgCc72OCEXUUb/qMy8l2vwirACYh+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037