UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kx1PVTspPvswsDxvA1sRuvGx0IpFu6xP1UGjsuLINGs=' 
WHERE 
  key_id = '64478de0451f6742546a00d2cd976dafd9d6ea2106f46453af4dfe570ebddaef' 
  AND (
    token = 'Kx1PVTspPvswsDxvA1sRuvGx0IpFu6xP1UGjsuLINGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063