UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't+Tl2ZjHQmeKwRBXUJiiAi3v60TC62Qx1zH+3IITV8U='
WHERE
key_id = 'bd934547b609ea7640a586b57d219ec6f8b8d4edca46a39f12cdf77a204df4c3'
AND (
token = 't+Tl2ZjHQmeKwRBXUJiiAi3v60TC62Qx1zH+3IITV8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)