UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iU0BnuQ86+WiUDXsyaSU7V9Xm2Q3hw3X5WZTu5w1jh4='
WHERE
key_id = '1a79a05d60f6be3f8fe1f7aee65991a563fb4b1352a416b83f24a91453947013'
AND (
token = 'iU0BnuQ86+WiUDXsyaSU7V9Xm2Q3hw3X5WZTu5w1jh4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)