UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G+mzfv53GiR3k20xB3KLY/oUVXllqQBuzFX3DkPMwf0=' 
WHERE 
  key_id = '7a25c0cf481ba3b67c1a907b1f5c768f2540793d089bc0115f2c578c25d9b42e' 
  AND (
    token = 'G+mzfv53GiR3k20xB3KLY/oUVXllqQBuzFX3DkPMwf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032