UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5c8bNvOH0PRfjpO0ZKSIAw9LgHa7TeNybLoO7IA4rb0='
WHERE
key_id = 'a69889dd3ba3ef33af2a90dca761d37d1debfbfa66d7aa5a1eb2be13a7219afc'
AND (
token = '5c8bNvOH0PRfjpO0ZKSIAw9LgHa7TeNybLoO7IA4rb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)