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