UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qiwsnghF4aAj3e5dCc/1T1YORQpjjiarT1R95CJOXgs='
WHERE
key_id = 'de5266c69b3976754b16d36ff95d7ae798da71bbe9b8165dd78815dcefe67c2b'
AND (
token = 'qiwsnghF4aAj3e5dCc/1T1YORQpjjiarT1R95CJOXgs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)