UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6sYW1QSwqt38sYZK4LQwKSXOioyW7AeQef4EOexMDhU='
WHERE
key_id = 'bfc6b0523b277a085efe32b14568fc8211bc0e8bb2a91df5d230a77c30fab2c1'
AND (
token = '6sYW1QSwqt38sYZK4LQwKSXOioyW7AeQef4EOexMDhU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)