UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eW1tDgmSmKY55AH8c0DpNJx00Kz5YqF0wwnAoJmxOew='
WHERE
key_id = '51c322b3875f7a7de0b9895d07ee69c5e388940769b281b5e4a18958600e10af'
AND (
token = 'eW1tDgmSmKY55AH8c0DpNJx00Kz5YqF0wwnAoJmxOew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)