UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fd+bXOVtnttSabGFfYRx4Ds3k/ZMTn4MK4y569HU8r8='
WHERE
key_id = '4e395fd120f53057a66f1ec15e5da6dc7848c87a3bc55bf17438483aa42f7fd5'
AND (
token = 'fd+bXOVtnttSabGFfYRx4Ds3k/ZMTn4MK4y569HU8r8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)