UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EehygSFFvUsvdsxoeoZ5izutsCSacWQEPiinmkT0k58='
WHERE
key_id = 'a5fc158accdd8c71948c1ca6eb71d8d2f89930eb28a4b52d4b2acb8b113b487e'
AND (
token = 'EehygSFFvUsvdsxoeoZ5izutsCSacWQEPiinmkT0k58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)