UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B/NDxaG66x3pKTE+4fhVNorEdrM6wiBAON6YFJLx2bA='
WHERE
key_id = '945dbf9750068e3e8d609ee57d591f477b2835cceab74f6d6c436d6e29ad3ee3'
AND (
token = 'B/NDxaG66x3pKTE+4fhVNorEdrM6wiBAON6YFJLx2bA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)