UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aGirPbKUYmLJa3FG64I/P9EpXUjFmB5cfdvUIpDru20='
WHERE
key_id = '454d1a0e830315d6adf3d7ab76fc500544e00bd481516950b0d6208656f0a6ae'
AND (
token = 'aGirPbKUYmLJa3FG64I/P9EpXUjFmB5cfdvUIpDru20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)