UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ROYkqhOYR0eg3oaaMqLrboIVU87mJ3UaZpNEIkww4s4='
WHERE
key_id = '1348a117b68eb7235060d23903d2f15417d7a42a86fba412e54802838f07720f'
AND (
token = 'ROYkqhOYR0eg3oaaMqLrboIVU87mJ3UaZpNEIkww4s4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)