UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'US+DUKwBEMPdiFpdktLJrh2to+ECornkL/nxlfFMRZU='
WHERE
key_id = 'c13c582aaebb73524262dff587cd6bb567cf6b2b04a9c11a5dfb4ba603fafca8'
AND (
token = 'US+DUKwBEMPdiFpdktLJrh2to+ECornkL/nxlfFMRZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)