UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J/1ds7xZTo1ap91LqMRMxklwL0PkbIT51vFw5zU8CY4='
WHERE
key_id = '4d6490a8b2a07c6a4b2636877515d27e5bcc6693eef79db998e10fa19af433da'
AND (
token = 'J/1ds7xZTo1ap91LqMRMxklwL0PkbIT51vFw5zU8CY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)