UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J0H4+aJ1tHGESB9wjBJxxk7lCYj/vSTmTBbNtiV6J30='
WHERE
key_id = '666c4d5fffb1558c8e23a8542bcc2dfabded895709df79452a812e60f589a82d'
AND (
token = 'J0H4+aJ1tHGESB9wjBJxxk7lCYj/vSTmTBbNtiV6J30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)