UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd+Max6BFX0B2jPe5c8FQULyH+uHm9uOW1mbjohHWKtE=' 
WHERE 
  key_id = 'dec16b8d9b047b16d8dbfe85d9697ea9dcbbc058cb11f22a032a4b8eb2761af3' 
  AND (
    token = 'd+Max6BFX0B2jPe5c8FQULyH+uHm9uOW1mbjohHWKtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034