UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kaatDvYXGjEH9oA0LaB66S9zuHAr/0wlvmr8pQsjeyk='
WHERE
key_id = 'bc7ec48203420a07bae0a29c410e033a15e330a7f9e27c42f4ec8e220900273b'
AND (
token = 'kaatDvYXGjEH9oA0LaB66S9zuHAr/0wlvmr8pQsjeyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)