UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xQLAuE9Jw8uaESQOARKAhS5HQt16ru/eG3Kxx6L+Sao='
WHERE
key_id = '587532ef0e88e8c6f0b2043446915be8907328fca91edeb3753dd234ca8fcdbc'
AND (
token = 'xQLAuE9Jw8uaESQOARKAhS5HQt16ru/eG3Kxx6L+Sao='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)