UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vw9/Ikb005KWqaeM9g+lwRJijqS/0zAO3kj9X+gRcLs='
WHERE
key_id = '54155d99f5e13af24e2345d0faf067d599918154a7222767ccff33a9a6ebc413'
AND (
token = 'vw9/Ikb005KWqaeM9g+lwRJijqS/0zAO3kj9X+gRcLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)