UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0AnWRbO5avkPt3fjfZPD/hw5Kxq95stL/ySysZ/oE1Y='
WHERE
key_id = '9f9c006f72e85ebfb1b0065c6af92adcdee217a7f57d51db5ffad38a0a802861'
AND (
token = '0AnWRbO5avkPt3fjfZPD/hw5Kxq95stL/ySysZ/oE1Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)