UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pT1JrDG0RhkJPgGDJNh+qM1Xc+UocxWkIhUNiSjRG/w=' 
WHERE 
  key_id = 'c9a53499ea92eed8c05db1a9c9c56908347e3147ee23c8d7eff8413efa960571' 
  AND (
    token = 'pT1JrDG0RhkJPgGDJNh+qM1Xc+UocxWkIhUNiSjRG/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029