UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tY2r6URbbHpqQXwDNld2GtkoiDhTqRpcFT3gaaPOVCM='
WHERE
key_id = '8d3889c2da986890997278a1cd55140971f2d5cd5e93f6f5ccbb84638dfa1081'
AND (
token = 'tY2r6URbbHpqQXwDNld2GtkoiDhTqRpcFT3gaaPOVCM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)